﻿using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.Collections.Generic;

public class SceneSelector : MonoBehaviour
{
    public Dropdown dropdown;
    public Button loadButton;
    public List<string> sceneNames;

    void Start()
    {
        dropdown.ClearOptions();
        dropdown.AddOptions(sceneNames);

        loadButton.onClick.AddListener(OnLoadButtonClicked);
    }

    void OnLoadButtonClicked()
    {
        int selectedIndex = dropdown.value;
        string sceneToLoad = sceneNames[selectedIndex];
        SceneManager.LoadScene(sceneToLoad);
    }
}
